﻿@model BrnMall.Manager.Domain.WeApp.StoreApplicationPaySetting

@section header{
    <title>微信支付设置</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.unobtrusive.js"></script>
    <link type="text/css" rel="stylesheet" href="/components/webuploader/webuploader.css" />
    <script type="text/javascript" src="/components/webuploader/webuploader.js"></script>
    <script type="text/javascript">
        delMessage = "如果图片为主图或轮播图,请您重新设置,您确定要删除吗？";

        $(function () {
            var uploader = WebUploader.create({
                pick: '.uploadBut',
                auto: true,
                swf: '/components/webuploader/Uploader.swf',
                server: '/storeadmin/tool/upload?operation=uploadwxpaycert',
                fileVal: 'upload',
                accept: {
                    title: 'Images',
                    extensions: '*',
                    mimeTypes: '*'
                }
            });

            uploader.on('uploadProgress', function(file, percentage) {
                $(".uploadPreview").html("上传中...");
            });

            uploader.on('uploadSuccess', function (file, response) {
                
                var data = response;
                if (data == "-1")
                    $("#errMessage").html('证书不能为空');
                else if (data == "-2")
                    $("#errMessage").html('证书类型不允许');
                else {
                    $("#errMessage").html("上传成功,请提交保存");
                    $("#CertPath").val(data._raw);
                }
            });

            uploader.on('uploadError', function(file) {
                $("#errMessage").html("上传失败");
            });
        });

    
    </script>

}
@section body{
    <h1 class="rightH1">
		微信小程序 &gt; <span class="rightH1-cur">微信支付设置</span>
        <div class="right">
            <a href="@Url.Action("StoreAppList","WeApp")" class="menuBT"><img src="/admin_store/images/goback.jpg" />返回列表</a>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>
    <div class="addTable">
        @using (Html.BeginForm("EditPaySetting","WeApp"))
        {
            
            @Html.HiddenFor(x=>x.Id)

            <table width="100%">
                <thead>
                <tr>
                    <td width="180px"></td>
                    <td style="color: darkorchid;font-size: 18px">微信支付设置</td>
                </tr>
                </thead>
                <tr>
                    <td width="180px" align="right">微信支付商户ID：</td>
                    <td>
                        @Html.TextBoxFor(x => x.MchId, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.MchId)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        微信支付商户KEY：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.MchKey, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.MchKey)

                        @Html.HiddenFor(x => x.StoreAppId, new { @class = "input", size = "3" })@Html.ValidationMessageFor(x => x.StoreAppId)
                       
                        说明: 微信支付商户KEY,在微信商户平台中“账户设置”--“账户安全”--“设置API密钥”中查看。
                    </td>
                </tr>
                <tr>
                    <td width="66px" align="right">证书名称：</td>
                    <td>@Model.CertPath</td>
                </tr>
                <tr>
                    <td width="66px" align="right">上传证书：</td>
                    <td>
                        <div class="upload">
                            
                            <div class="left">
                                <div class="uploadBut">选择证书</div>
                            </div>
                            <div class="clear"></div>
                            <div class="left"><span id="errMessage" style="color: red"></span></div>
                            <div class="clear"></div>
                            <div class="left"><p>1,上传格式为*****.p12,如：apiclient_cert.p12</p>
                                <p>2,设置好微信证书以后，才能使用微信红包和微信批量放款相关功能。</p></div>
                        </div>
                        @Html.HiddenFor(x => x.CertPath, new { @class = "input", size = "3" })
                    </td>
                </tr>
                
            </table>
            
            <table width="100%">
                <tr>
                    <td width="180px" align="right" >
                        &nbsp;
                    </td>
                    <td>
                        <a href="" class="addBt" id="sumbitBut">
                            <img src="/admin_store/images/submit.jpg" />
                        </a>
                        <script type="text/javascript">
                            $(function () {
                                $("#sumbitBut").click(function () {
                                    $("form:first").submit();
                                    return false;
                                })
                            });
                        </script>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        }
    </div>
}